// 产品抽象接口
public interface IProduct {}

// 车 抽象接口
public interface ICar: IProduct {}

// 自行车 抽象接口
public interface IBike: IProduct {}

// 具体产品 - 特斯拉电动车
public class TeslaCar: ICar 
{
    public TeslaCar ()
    {
        Console.WriteLine("生产 Tesla 电动车");
    }
}

// 具体产品 - 特斯拉自行车
public class TeslaBike: IBike 
{
    public TeslaBike ()
    {
        Console.WriteLine("生产 Tesla 自行车");
    }
}

// 具体产品 - 奔驰汽车
public class BenzCar: ICar 
{
    public BenzCar ()
    {
        Console.WriteLine("生产 奔驰 汽油车");
    }
}

// 具体产品 - 奔驰自行车
public class BenzBike: IBike 
{
    public BenzBike ()
    {
        Console.WriteLine("生产 奔驰 自行车");
    }
}

// 抽象工厂
public interface IProductFactory
{
    ICar BuildCar ();
    IBike BuildBike ();
}

// 具体工厂类 - 特斯拉工厂
public class TeslaProductFactory: IProductFactory
{
    public ICar BuildCar ()
    {
        return new TeslaCar();
    }

    public IBike BuildBike ()
    {
        return new TeslaBike();
    }
}

// 具体工厂类 - 奔驰工厂
public class BenzProductFactory: IProductFactory
{
    public ICar BuildCar ()
    {
        return new BenzCar();
    }

    public IBike BuildBike ()
    {
        return new BenzBike();
    }    
}

public class Customer
{
    public static void Main()
    {
        IProductFactory factory = null;
        factory = new TeslaProductFactory();
        var tesla_car = factory.BuildCar();
        var tesla_bike = factory.BuildBike();

        factory = new BenzProductFactory();
        var benz_car = factory.BuildCar();
        var benz_bike = factory.BuildBike();
    }
}